package cn.csc.module.product.controller.app.tag;

import cn.csc.framework.common.pojo.CommonResult;
import cn.csc.module.product.controller.app.tag.vo.AppDefaultSpuTagRespVO;
import cn.csc.module.product.convert.tag.SpuTagConvert;
import cn.csc.module.product.dal.dataobject.tag.SpuTagDO;
import cn.csc.module.product.service.tag.SpuTagService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

import static cn.csc.framework.common.pojo.CommonResult.success;

/**
 * @author liuchuang
 * @version 1.0
 * @date 2024/10/17 17:05
 * @modify
 */
@Api(tags = "管理后台 - 商品标签")
@RestController
@RequestMapping("/product/spu-tag")
@Validated
public class AppSpuTagController {

    @Resource
    private SpuTagService spuTagService;

    @GetMapping("/default")
    @ApiOperation("获得默认商品标签列表")
    public CommonResult<List<AppDefaultSpuTagRespVO>> getSpuTagList() {
        List<SpuTagDO> list = spuTagService.getDefault();
        return success(SpuTagConvert.INSTANCE.convertList2(list));
    }


}
